package com.example.ibsp_demo.pojo.entity.user;

import java.util.Date;

public class UserActivity {
    private Integer id;            // 记录ID
    private Integer userId;     // 参与用户ID
    private Integer activityId;    // 活动ID
    private Date joinTime;      // 参与时间
    private Integer status;     // 参与状态（0-已报名，1-已参加，2-已取消）
    private String feedback;    // 用户活动反馈

    // 无参构造函数
    public UserActivity() {
    }

    // 有参构造函数
    public UserActivity(Integer id, Integer userId, Integer activityId, Date joinTime,
                        Integer status, String feedback) {
        this.id = id;
        this.userId = userId;
        this.activityId = activityId;
        this.joinTime = joinTime;
        this.status = status;
        this.feedback = feedback;
    }

    // Getters and Setters
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Integer getActivityId() {
        return activityId;
    }

    public void setActivityId(Integer activityId) {
        this.activityId = activityId;
    }

    public Date getJoinTime() {
        return joinTime;
    }

    public void setJoinTime(Date joinTime) {
        this.joinTime = joinTime;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getFeedback() {
        return feedback;
    }

    public void setFeedback(String feedback) {
        this.feedback = feedback;
    }

    // 业务方法：判断用户是否已确认参加活动
    public boolean hasConfirmed() {
        return status == 1;
    }

    // 业务方法：判断用户是否已取消参加
    public boolean hasCancelled() {
        return status == 2;
    }

    @Override
    public String toString() {
        return "UserActivity{" +
                "id=" + id +
                ", userId=" + userId +
                ", activityId=" + activityId +
                ", joinTime=" + joinTime +
                ", status=" + status +
                '}';
    }
}